package com.feri.fc.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 千锋Java,为你而生！
 *
 * @Author: Feri
 * @Date:2024/11/26 10:05
 * @Modified:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R<T> {
    private int code;
    private String msg;
    private T data;

    /**
     * 成功*/
    public static R<String> ok(){
        return ok(null);
    }
    /**
     * 成功 返回数据*/
    public static <T> R<T> ok(T obj){
        return new R(0,"操作成功",obj);
    }
    /**
     * 失败*/
    public static R fail(){
        return fail("本次请求操作失败！");
    }
    /**
     * 失败 返回内容*/
    public static <T> R<T> fail(T data) {
        return new R(1, "操作失败", data);
    }
}
